<div class="content" style="margin-top: 2.3rem;">
    <div class="content_bg content_user" style="height: 100%;">
        <form action="<{link app=b2c ctl=wap_passport act=post_login}>" class="form"  method="post" data-type="ajax">
            <input type="hidden" name="forward" value="<{$forward}>">
            <div class="content_user_title">用户登录</div>

            <div class="list-block">
                <ul>
                  <li>
                    <div class="item-content" style="padding-left: 0;">
                      <div class="item-inner">
                        <{img src="images/user_icon1.png" app='wap' class="user_number_icon_a"}>
                        <div class="item-title label user_number">账号 :</div>
                        <div class="item-input">
                          <input type="text"  name="uname" value="<{$loginName}>"  placeholder="请输入您的用户名(与商城账号一致)" class="text a-account" required="required" data-caution="用户名不能为空">
                        </div>
                      </div>
                    </div>
                  </li>

                    <li class="a-need-verify" style="display: none">
                        <div class="item-content" style="padding-left: 0;">
                            <div class="item-inner">
                                <img class="user_number_icon_a" src="images/user_icon1.png">
                                <div class="item-title label user_number">验证码 :</div>
                                <div class="item-input">
                                    <input type="text" name="mobileVcode" id="" placeholder="填写验证码" class="text"><a href="<{link app=b2c ctl=wap_passport act=send_vcode_sms}>" class="btn orange ib-btn btn-send"><span><span>获取验证码</span></span></a>
                                </div>
                            </div>
                        </div>
                    </li>


                  <li>
                    <div class="item-content" style="padding-left: 0;">
                      <div class="item-inner">
                       <{img src="images/user_icon2.png" app='wap' class="user_number_icon_a"}>
                        <div class="item-title label user_number">密码 :</div>
                        <div class="item-input">
                          <input type="password" name="password" placeholder="请输入密码"class="text" required="required" data-caution="密码不能为空">
                        </div>
                            <{img src="images/user_icon3.png" app='wap' class="user_number_icon_b"}>
                            
                            <div class="clearfix"></div>
                      </div>
                    </div>
                  </li>



                </ul>
            </div>
            <div class="user_button_box">
                <!--<a href="#" class="user_button_a">登录</a>-->
                <button type="submit" class="user_button_a" rel="_request">登录</button>
                <a href="<{link app=b2c ctl=wap_passport act=signup}>" class="user_button_b">点击注册</a>
                <a href="<{link app=b2c ctl=wap_passport act=lost}>" class="user_button_c">忘记密码?</a>
                <div class="clearfix"></div>
            </div>
        </form>
        <div class="user_cue">
            <{img src="images/user_icon4.png" app='wap' class="user_cue_img"}><span>如需解绑请至个人中心点击解除绑定</span>
            <div class="clearfix"></div>
        </div>
    </div>

    

</div>
<script>
    $('.form .a-account').change(function(e) {
        if(/^1[3458]\d{9}$/.test(this.value)) {
            $.post('<{link app=b2c ctl=wap_passport act=login_ajax_account}>', this.name + '=' + this.value, function(rs){
                if(rs) {
                    try{
                        rs = $.parseJSON(rs);
                    } catch (e) {}
                    if(rs.error) {
                        if(typeof rs.error === 'string') alert(rs.error);
                    }
                    else if(rs.needVerify === 'true') {
                        $('.form .a-need-verify').show();
                    }
                }
            });
            // alert('您的手机号码还未通过验证，点击进行验证');
        }
        else {
            $('.form .a-need-verify').hide();
        }
    });

    $('.form .btn-send').click(function (e) {
        e.preventDefault();
        var el = $('.form .a-account');
        if($(this).hasClass('disabled')) return false;
        sendVerify(this, el.attr('name') + '=' + el.val() + '&type=activation');
    });

    function sendVerify(el, data) {
        var url = el.href;
        $(el).addClass('disabled');
        var cd = new countdown(el, {
            start: 120,
            secondOnly: true,
            callback: function(e) {
                $(el).removeClass('disabled').html('重发密码');
            }
        });
        $.post(url, data, function(rs) {
            if(rs) {
                try{
                    rs = $.parseJSON(rs);
                } catch (e) {}
                if(rs.error) {
                    $(el).removeClass('disabled').html('重发密码');
                    clearTimeout(cd.timer);
                    if(typeof rs.error === 'string') alert(rs.error);
                }
            }
        });
    }
    $('.user_number_icon_b').on('touchstart',function(){
        $('input[name=password]').attr('type','text');
    });
    $('.user_number_icon_b').on('touchend',function(){
        $('input[name=password]').attr('type','password');
    });
</script>